package com.bailan.foreat.mapper;

import com.bailan.foreat.entity.Address;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Update;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author ste
 * @since 2023-02-21 07:50:43
 */
@Mapper
public interface AddressMapper extends BaseMapper<Address> {

    @Update("UPDATE t_address SET is_default=0 WHERE user_id=#{userId}")
    void clearIsDefault(Integer userId);

    @Update("UPDATE t_address SET status=1 WHERE id=#{addressId}")
    void deleteAddressById(Integer addressId);
}
